import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import { createPinia } from "pinia";
import { useUserStore } from "./stores/userInfo";
import { defineProperties } from "@/properties/index.js";
import { defineDirectives } from "@/directives/index.js";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
// vant 桌面端适配
import "@vant/touch-emulator";

const app = createApp(App);
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
app.use(pinia);

// 添加全局方法
defineProperties(app);
//注册自定义指令
defineDirectives(app);
//引入全局规范样式
import "./scss/index.scss";
import "./assets/iconfonts/iconfont.css";

app.use(router);
app.mount("#app");

// //用户信息
// const userStore = useUserStore();

// // 路由守卫
// router.beforeEach((to, from, next) => {
// // 没有获取到用户id 跳转到自动登录页面
//   if (to.name !== "autoLogin" && !userStore.userid) next({ name: "autoLogin" });
//   else next();
// });
